﻿using System;
using System.Collections.Generic;
using System.Data.Metadata.Edm;
using System.Linq;
using System.Text;

namespace Servicios.Business.Extensions
{
    public static class Extensions
    {

        public static string GetEntitySetFullName(
            this MetadataWorkspace mdw,
            string entityName)
        {
            var entContainer = mdw.GetItems<EntityContainer>(DataSpace.CSpace).First();
            var entsets =
                  from eset in entContainer.BaseEntitySets
                  where eset.ElementType.Name == entityName
                  select eset;
            var containerName = entsets.First().EntityContainer.Name;
            return containerName + "." + entsets.First().Name;
        }
    }
}
